<!DOCTYPE html>
<html>
<head>
<title>标种配置管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../include/resources.html">
<script type="text/javascript">
	var dataGrid;
	var winWidth = 800;
	var winHeight = 500;
	var addTitle = "添加";
	var addUrl =  "/modules/system/borrowConfig/borrowConfigAddPage.html";
	var editTitle = "编辑";
	var editUrl =  "/modules/system/borrowConfig/borrowConfigEditPage.html";
	var addWinParmeters = "'{0}','"+addTitle+"',"+winWidth+","+winHeight+",'"+addUrl+"'";
	$(function() {
		var editIndex = undefined;
		dataGrid = $('#dataGrid').datagrid({
			url : 'borrowConfigList.html',
			fit : true,
            fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : pageSize,
			pageNums :1,
			pageList : pageList,
			sortName : 'id',
			sortOrder : 'asc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			singleSelect:true,
				
			columns : [ [ 
				{ field: 'id', title: '编号', width: 50, checkbox : false},
				{ field: 'cname', title: '标识', width: 70, sortable:false},
				{ field: 'name', title: '名称', width: 60, sortable:false},
				{ field: 'trail', title: '跳过初审', width: 60, sortable:false,
					formatter:function(value, row, index){
						if(value){
							return "是";
						} else if(!value){
							return "否"; 
						} else {
							return value;
						}
					}	
				}, 
				{ field: 'review', title: '跳过复审', width: 60, sortable:false,
					formatter:function(value, row, index){
						if(value){
							return "是";
						} else if(!value){
							return "否";
						} else {
							return value;
						}
					}	
				}, 
				/* { field: 'identify', title: '认证条件', width: 80, sortable:false}, */
				{ field: 'manageFee', title: '借款管理费费率(%)', width: 100, sortable:false},
				{ field: 'dayManageFee', title: '日借款管理费费率(%)', width: 100, sortable:false},
				{ field: 'enable', title: '状态', width: 50, sortable:false,
					formatter:function(value, row, index){
						if(value){
							return "启用";
						} else if(!value){
							return "未启用";
						} else {
							return value;
						}
					}	
				},
				{ field : 'showInfo',
	                title : '其他信息',
	                width :75,
	                align:'center',
	                fixed:true,
	                formatter : function(value, row, index) {
						var content = '<a href="javascript:void(0);" class="j-showInfo">查看<i class="iconfont">&#xe639;</i></a>'
							+ '<div class="showInfoSingleDiv">'
							+ '<div class="showInfo">'
							+ '<em></em><h2>借款标配置信息</h2>'
							+ '<ul>'
							+ '<li>'
	                		+ '<span>性	质：</span>'
							+ row.nature
							+ '</li>'
							+ '<li>'
	                		+ '<span>描	述：</span>'
							+ row.remark
							+ '</li>'
							+ '</ul></div></div>';
						return content;
					}
				},
				{	field : 'action',
					title : '操作',
					width :50,
					fixed:true,
					formatter : function(value, row, index) {
						var str = '';
						str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="'+editTitle+'">编辑</a>';
						return str;
					}
				} 
			] ],
			toolbar : '#toolbar'
		});
	});

	function getIndexAfterDel(){  
	    var selected = $('#dataGrid').datagrid('getSelected');  
	    var index = $('#dataGrid').datagrid('getRowIndex', selected);  
	    return index;  
	} 
	function saverow(index,obj){
		var tmpIndex = getIndexAfterDel();    
		$('#dataGrid').datagrid('endEdit', index);  
	    var node = $('#dataGrid').datagrid('getSelected');  
	    var json = {};  
	    json.id = node.id;  
	    json.nid = node.nid;  
	    json.name = node.name;
	    json.value = node.value;
	    json.status = node.status;  
	    $.ajax({  
            url:'/modules/system/borrowConfig/borrowConfigEdit.html?randomTime=' + (new Date()).getTime(),  
            type : 'post',  
            data : json, 
            dataType : 'json',  
            timeout : 60000,  
            success : function(data, textStatus, jqXHR) {     
				if (data.result){  
                   	$.messager.alert('提示', '保存成功！', function() {  
                    	$('#dataGrid').datagrid('reload');  
                    });  
             	 }else{
             		$.messager.alert('提示', '保存失败！');
             	 } 
  
            }  
        });  
	}	
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text" name="searchName" autocomplete="off" class="sInput" placeholder="输入标识/名称进行搜索" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a>
	            	<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
           <!--  <div class="sRight">
				<a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加</a>					
            </div> -->
		</div>
		<div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
			<table id="dataGrid"></table>
		</div>
	</div>
</body>
</html>
